﻿<%@ Page Title="" Language="C#" MasterPageFile="~/MasterPage.Master" AutoEventWireup="true" CodeBehind="ManageTimePart.aspx.cs" Inherits="MyHospital.web.ManageTimePart" %>
<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">
    <style>
        .tmright {
            width:400px;
        }
        .tmright table {
            width:380px;
        }
        .tmright select:first-child {
            margin-left: -195px;
        }
        .tmleft {
            width: 400px;
            height: 400px;
            padding-top: 12px;
        }
    </style>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">
    <table>
        <tr>
            <td>
                <div class="tmright">
            <asp:DropDownList ID="dlsDepart" runat="server" DataSourceID="ldsDpart" AutoPostBack="true" DataTextField="departName" DataValueField="departId"  DefaultValue="1" AppendDataBoundItems="true" ></asp:DropDownList>
                <asp:GridView ID="gvDoctor" runat="server" AllowPaging="True" DataKeyNames="doctorId"  HorizontalAlign="Center" DataSourceID="ldsDoctor" AutoGenerateColumns="False" PageSize="3" style="margin-top:0px;margin-left:10px" OnSelectedIndexChanged="gvDoctor_SelectedIndexChanged">
                    <Columns>
                        <asp:BoundField DataField="doctorId" HeaderText="医生编号" ReadOnly="True" SortExpression="doctorId" ItemStyle-Height="115px" ItemStyle-Width="60px">
                        </asp:BoundField>
                        <asp:BoundField HeaderText="医生姓名" DataField="doctorName" ReadOnly="True" SortExpression="doctorName" ItemStyle-Width="80px" >
                        </asp:BoundField>
                        <asp:ImageField DataImageUrlField="image" HeaderText="照片" ReadOnly="True"  SortExpression="image" ItemStyle-Width="120px">
                        </asp:ImageField>
                        <asp:CommandField ShowSelectButton="True" SelectText="选择" />
                    </Columns>
                </asp:GridView>
                  </div>
            </td>
                <td class="auto-style1">
                    <div class="tmleft">
                    <asp:GridView ID="gvTime" runat="server" AllowPaging="True" DataSourceID="ldsTime" AutoPostBack="true" AutoGenerateColumns="False" PageSize="6" AllowSorting="True" >
                        <Columns>
                            <asp:BoundField DataField="timeId" HeaderText="时间编号" ReadOnly="True" SortExpression="timeId" ItemStyle-Height="60px" ItemStyle-Width="100px">
<ItemStyle Height="60px"></ItemStyle>
                            </asp:BoundField>
                            <asp:BoundField HeaderText="时间" DataField="time" SortExpression="time" ItemStyle-Width="160px" ReadOnly="True">
<ItemStyle Width="160px"></ItemStyle>
                            </asp:BoundField>
                            <asp:BoundField DataField="number" HeaderText="人数" ReadOnly="True" SortExpression="number" ItemStyle-Width="160px">
<ItemStyle Width="160px"></ItemStyle>
                            </asp:BoundField>
                            <asp:TemplateField ItemStyle-Width="40px">
                    <ItemTemplate>
                        <input type="radio" name="myRadio" value='<%# Container.DataItemIndex.ToString() %>'>
                        </form>
                    </ItemTemplate>
<ItemStyle Width="40px"></ItemStyle>
                </asp:TemplateField>
                        </Columns>
                    </asp:GridView>
                    </div>
                    <script type="text/javascript">
                    function setNowRadio(v) {
                        //alert(v);
                        var myForm, objRadio;
                        myForm = document.forms[0];
                        for (var i = 0; i < myForm.length; i++) {
                            if (myForm.elements[i].type == "radio") {
                                objRadio = myForm.elements[i];
                                //alert(objRadio.name);
                                //alert(objRadio.value);
                                if (objRadio.value == v) {
                                    objRadio.checked = true;
                                }
                            }
                        }
                    }
                    <asp:Literal ID="jsLiteral" runat="server"></asp:Literal>
                    </script>
            </td>
            <td>
                <div class="time" style="padding: 0px 23px 0;">
                <asp:Calendar ID="Calendar" runat="server" BackColor="White" BorderColor="White" BorderWidth="1px" Font-Names="Verdana" Font-Size="9pt" ForeColor="Black" Height="190px" NextPrevFormat="FullMonth" Width="350px" DefaultValue="2022-06-13" OnSelectionChanged="Calendar_SelectionChanged">
                    <DayHeaderStyle Font-Bold="True" Font-Size="8pt" />
                    <NextPrevStyle Font-Bold="True" Font-Size="8pt" ForeColor="#333333" VerticalAlign="Bottom" />
                    <OtherMonthDayStyle ForeColor="#999999" />
                    <SelectedDayStyle BackColor="#333399" ForeColor="White" />
                    <TitleStyle BackColor="White" BorderColor="Black" BorderWidth="4px" Font-Bold="True" Font-Size="12pt" ForeColor="#333399" />
                    <TodayDayStyle BackColor="#CCCCCC" />
                </asp:Calendar>
                <br />
                <asp:Label ID="LableInsert" runat="server" Text="选择时间" ForeColor="Red"></asp:Label>
                <asp:Label ID="LableUpdate" runat="server" Text="选择时间" ForeColor="Red"></asp:Label>
                <table id="aaa">
                    <tr>
                        <td>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</td>
                        <td>
                            <asp:CheckBoxList ID="ChkTime" runat="server" RepeatColumns="1" Width="100px" Height="50px" OnSelectedIndexChanged="ChkTime_SelectedIndexChanged">
                            <asp:ListItem>8:30-9:30</asp:ListItem>
                             <asp:ListItem>9:30-10:30</asp:ListItem>
                            <asp:ListItem>10:30-11:30</asp:ListItem>
                             <asp:ListItem>14:30-15:30</asp:ListItem>
                             <asp:ListItem>15:30-16:30</asp:ListItem>
                             <asp:ListItem>16:30-17:30</asp:ListItem>
                            </asp:CheckBoxList>
                        </td>
                        <td>
                            <table id="ww" style="width:100px;height:50px"> 
                                <tr>
                                    <td>
                                        <asp:DropDownList ID="ddTimeInser1" runat="server" style="width:100px;margin-top:6px">
                                <asp:ListItem>1</asp:ListItem>
                                <asp:ListItem>2</asp:ListItem>
                                <asp:ListItem>3</asp:ListItem>
                                <asp:ListItem>4</asp:ListItem>
                            </asp:DropDownList>
                                    </td>
                                </tr>
                                <tr>
                                    <td>
                                        <asp:DropDownList ID="ddTimeInser2" runat="server" style="width:100px;margin-top:6px">
                                <asp:ListItem>1</asp:ListItem>
                                <asp:ListItem>2</asp:ListItem>
                                <asp:ListItem>3</asp:ListItem>
                                <asp:ListItem>4</asp:ListItem>
                            </asp:DropDownList>
                                    </td>
                                </tr>
                                <tr>
                                    <td>
                                        <asp:DropDownList ID="ddTimeInser3" runat="server" style="width:100px;margin-top:6px">
                                <asp:ListItem>1</asp:ListItem>
                                <asp:ListItem>2</asp:ListItem>
                                <asp:ListItem>3</asp:ListItem>
                                <asp:ListItem>4</asp:ListItem>
                            </asp:DropDownList>
                                    </td>
                                </tr>
                                <tr>
                                    <td>
                                        <asp:DropDownList ID="ddTimeInser4" runat="server" style="width:100px;margin-top:6px">
                                <asp:ListItem>1</asp:ListItem>
                                <asp:ListItem>2</asp:ListItem>
                                <asp:ListItem>3</asp:ListItem>
                                <asp:ListItem>4</asp:ListItem>
                            </asp:DropDownList>
                                    </td>
                                </tr>
                                <tr>
                                    <td>
                                        <asp:DropDownList ID="ddTimeInser5" runat="server" style="width:100px;margin-top:6px">
                                <asp:ListItem>1</asp:ListItem>
                                <asp:ListItem>2</asp:ListItem>
                                <asp:ListItem>3</asp:ListItem>
                                <asp:ListItem>4</asp:ListItem>
                            </asp:DropDownList>
                                    </td>
                                </tr>
                                <tr>
                                    <td>
                                        <asp:DropDownList ID="ddTimeInser6" runat="server" style="width:100px;margin-top:6px">
                                <asp:ListItem>1</asp:ListItem>
                                <asp:ListItem>2</asp:ListItem>
                                <asp:ListItem>3</asp:ListItem>
                                <asp:ListItem>4</asp:ListItem>
                            </asp:DropDownList>
                                    </td>
                                </tr>
                            </table>
                        </td>
                    </tr>
                </table>
                <asp:Button ID="InsertSubmit" runat="server" Text="增加" OnClick="InsertSubmit_Click" />
                <asp:Button ID="UpdateSubmit" runat="server" Text="修改" OnClick="UpdateSubmit_Click" />
                <asp:Label ID="lblMassage" runat="server" Text=""></asp:Label>
                </div>
             </td>
            
        </tr>
    </table>
    <table ID="operate" style="margin-top: -8px;">
        <tr><td>
            &nbsp;</td></tr>
        <tr>
            <td>
                <asp:Button ID="insertAllTime" runat="server" Text="增加一天" Width="100px" OnClick="insertAllTime_Click"/>
            </td>
            <td>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</td>
            <td>
                <asp:Button ID="deleteTime" runat="server" Text="删除一条" Width="100px " OnClick="deleteTime_Click" OnClientClick="javascript:return confirm('真的要删除吗？');"/>
            </td>
            <td>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</td>
            <td>
                <asp:Button ID="deleteAllDisease" runat="server" Text="删除一天" Width="100px " OnClick="deleteAllDisease_Click" OnClientClick="javascript:return confirm('真的要删除吗？');"/>
            </td>
            <td>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</td>
            <td>
                <asp:Button ID="updateDisease" runat="server" Text="修改时间" Width="100px" OnClick="updateDisease_Click"/>
            </td>
            <td>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</td>
            <td>
                <asp:Label ID="lblMassage1" runat="server" Text=" " ForeColor="Red"></asp:Label>
            </td>
        </tr>
    </table>
        <asp:LinqDataSource ID="ldsDpart" runat="server" ContextTypeName="MyHospital.DAL.MyHospitalDataContext" EntityTypeName="" TableName="Department"></asp:LinqDataSource>
    <asp:LinqDataSource ID="ldsDoctor" runat="server" ContextTypeName="MyHospital.DAL.MyHospitalDataContext" EntityTypeName="" Select="new (doctorName, image, doctorId)" TableName="Doctor" Where="departId == @departId">
        <WhereParameters>
            <asp:ControlParameter ControlID="dlsDepart" DefaultValue="1" Name="departId" PropertyName="SelectedValue" Type="Int32" />
        </WhereParameters>
    </asp:LinqDataSource>
    <asp:LinqDataSource ID="ldsTime" runat="server" ContextTypeName="MyHospital.DAL.MyHospitalDataContext" EntityTypeName="" Select="new (time, number, date, timeId)" TableName="TimePart" Where="doctorId == @doctorId &amp;&amp; date == @date">
        <WhereParameters>
            <asp:ControlParameter ControlID="gvDoctor" DefaultValue="1" Name="doctorId" PropertyName="SelectedValue" Type="Int32" />
            <asp:ControlParameter ControlID="Calendar" DefaultValue="2022-06-13" Name="date" PropertyName="SelectedDate" Type="DateTime" />
        </WhereParameters>
    </asp:LinqDataSource>
</asp:Content>
<asp:Content ID="Content3" ContentPlaceHolderID="ContentPlaceHolder2" runat="server">
</asp:Content>

